import {createApp} from 'vue';
import pinia from '/@/stores/index';
import App from '/@/App.vue';
import router from '/@/router';
import {directive} from '/@/directive';
import {i18n} from '/@/i18n';
import other from '/@/utils/other';

import ElementPlus from 'element-plus';
import '/@/theme/index.scss';
import VueGridLayout from 'vue-grid-layout';

const app = createApp(App);

directive(app);
other.elSvg(app);

const modules = import.meta.glob('./components/**/*.vue', {eager: true});
Object.keys(modules).forEach((path) => {
    const name = path.match(/\.\/components\/(.*)\.vue$/)?.[1] || '';
    if (name) {
        app.component(modules[path].default.name, modules[path].default)
    }
})

app.use(pinia).use(router).use(ElementPlus).use(i18n).use(VueGridLayout).mount('#app');
